<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <link href='http://fonts.googleapis.com/css?family=Droid+Sans:400|Lobster' rel='stylesheet' type='text/css'>
  <link rel="stylesheet" href="style.css">
<style type="text/css">@import url(Calendar-win2k-1.css);</style>
<script type="text/javascript" src="Calendar.js"></script>
<script type="text/javascript" src="Calendar-es.js"></script>
<script type="text/javascript" src="Calendar-setup.js"></script>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Fulbito Jueliz</title>
</head>

<body>
<script>
function Validar()
{
	FechaInicio=ListarAlquiler.txtDiaInicio.value;
	FechaFin=ListarAlquiler.txtDiaFin.value;

	
		var acumula="";

   	if(FechaInicio==""){acumula+="Registre la Fecha de Inicio \n";}
	if(FechaFin==""){acumula+="Registre la Fecha de Fin \n";}
	 

	 	if(acumula!="")
	 	{ 
			 alert(acumula); 
		}
	 	else
	 		{
	 			document.ListarAlquiler.submit();
	 		}
}

function ValidaLetras()
{
	txt = window.event.keyCode;
	if(txt!=32 &&  txt<65 || window.event.keyCode>90 && window.event.keyCode<97 || window.event.keyCode>122)
	{
		window.event.keyCode=0;
		}
	}
	function ValidaNumeros(){
	if(window.event.keyCode<48 || window.event.keyCode>57){
	window.event.keyCode=0;}
	}
	function Principal(){
			location.href='Principal.jsp';
	}
</script>
<form id="ListarAlquiler" name="ListarAlquiler" method="post" action="ListarAlquilerCanchaServlet">
  <table width="950" height="393" border="1">
    <tr bgcolor="#FF9933">
      <td colspan="3" align="center"><h1><marquee Behavior= "alternate" scrollamount=7>Listar Alquiler de Canchas de Futbol</marquee></h1></td>
    </tr>
    <tr bgcolor="#FF9933">
      <td colspan="3">&nbsp;</td>
    </tr>
    <tr bgcolor="#FF9933">
      <td width="117">Nombre del Local</td>
      <td width="699">
      <%@page import="anonymus.negocio.LocalNegocio,anonymus.modelo.Local,java.util.*" %>


	<select name="cboNombreLocal">
    
    <%
    LocalNegocio neg = new LocalNegocio();
	ArrayList Local = (ArrayList)neg.Listar();
	for(int i=0; i<Local.size();i++)
	{
    	Local entLocal=(Local)Local.get(i);
    %>
            <option value="<%=entLocal.getCodLocal()%>" selected> <%= entLocal.getNombreLoc() %></option>
            <%
            }
            %>
	</select>
      
      </td>
     
    </tr>
    <tr bgcolor="#FF9933">
      <td>Fecha de Inicio</td>
      <td><input type="text" id="txtDiaInicio"  readonly="readonly" name="txtDiaInicio"> <input type="button" id="triggerInicio" value="..."></td>
      
    </tr>
    <tr bgcolor="#FF9933">
      <td>Fecha de Fin</td>
      <td><input type="text" id="txtDiaFin" readonly="readonly" name="txtDiaFin"> <input type="button" id="triggerFin" value="..."></td>
      
    </tr>

    <tr bgcolor="#FF9933">
      <td colspan="3">&nbsp;</td>
    </tr>
    <tr bgcolor="#FF9933">
      <td align="center"><a class="button" name="btnBuscar" id="btnBuscar" onclick="Validar()">Listar</a></td>
      <td align="center"><a class="button" name="btnCancelar" id="btnCancelar" onclick="Principal()">Regresar</a></td>
    </tr>
  </table>
</form>
<script type="text/javascript"> 
  function dateChanged(calendar) {
    if (calendar.dateClicked) {
      var y = calendar.date.getFullYear();
      var m = calendar.date.getMonth();
      var d = calendar.date.getDate();
      window.location = "ListarAlquilerCanchaServlet";
    }
  };

  Calendar.setup(
    {
      inputField  : "txtDiaInicio",
      ifFormat    : "%Y-%m-%d",
      button      : "triggerInicio"
    }
  );
  
    Calendar.setup(
    {
      inputField  : "txtDiaFin",
      ifFormat    : "%Y-%m-%d",
      button      : "triggerFin"
    }
  );
 </script>
 
 <table border="1" cellpadding="0" cellspacing="0" bgcolor="#FF9933" style="width: 915px;  ">
  <tr>
  	<th width="70" scope="col" style="width: 150px; ">Nombre de Local</th>
    <th width="40" scope="col" style="width: 150px; ">Nombre de Cancha</th>
    <th width="40" scope="col" style="width: 150px; ">Caracteristicas</th>
    <th width="40" scope="col" style="width: 150px; ">Fecha de Alquiler</th>
    <th width="40" scope="col" style="width: 150px; ">Foto</th>

    
  </tr>
  
  <%@page import="java.util.*, anonymus.modelo.Cancha" %>
<%

Collection<Cancha> canchas = (ArrayList<Cancha>)request.getAttribute("Canchitas");

if(canchas != null) { 

int i = 1;

for(Cancha x : canchas) {
%>  
  <tr>
    <td><% out.print(x.getNombreLocal()); %></td>
	<td><% out.print(x.getNombreCancha()); %></td>
	<td><% out.print(x.getCaracteristicasCancha()); %></td>
	<td><% out.print(x.getFecha() + " " + x.getInicio() + " " + x.getFin()); %></td>
	<td><% out.print(x.getFoto()); %></td>
  </tr>
<% }  
  } %>
 
    
  </table>
 
</body>
</html>
